package cn.pxy.ysframework.web.Service.Impl;

import cn.pxy.ysframework.web.Entity.Account;
import cn.pxy.ysframework.web.Repository.IAccountDao;
import cn.pxy.ysframework.web.Service.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AccountService implements IAccountService {
    @Autowired
    private IAccountDao accountDao;

    @Override
    public Account getAccountByAccountnameAndPassword(String name, String password) {
        return accountDao.findByAccountnameAndPassword(name,password);
    }

    @Override
    public Account getAccountByUserName(String name) {
        return accountDao.findByAccountname(name);
    }

    @Override
    public Account Register(Account account) {
        return accountDao.save(account);
    }

    @Override
    public Account findById(String id) {
        return accountDao.findById(id).get();
    }
}
